﻿<%@ Page Title="Lar São José" Language="C#" AutoEventWireup="true" MasterPageFile="~/Site1.Master" CodeBehind="Alimentos.aspx.cs" Inherits="LarDosIdosos.Alimentos" %>
<%@ Register Assembly="LarDosIdosos" TagPrefix="asc" Namespace="LarDosIdosos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="divPrincipal">
    <div class="divCentralizadora" style="margin-top:50px;">
        <asp:UpdatePanel ID="updatePanelAlimentos" runat="server" UpdateMode="Always" >
            <ContentTemplate>
                <div style="float:left;width:100%;padding-left:50px;" ID="divPrintJs" runat="server">
                    <script src="jscript/jquery-1.8.2.min.js" type="text/javascript"></script>
                    <script src="jscript/jquery.printElement.js" type="text/javascript"></script>
                    <script  type="text/javascript">
                        function PrintDiv() {
                            $('#<%= gridViewAlimentos.ClientID %>').printElement();
                        }
                    </script>
		            <a href='#' onclick="PrintDiv()">
			            <asp:Image BorderWidth="0" runat="server" ID="imagePrint" ImageUrl="~/Imagens/IconPrintPage.png" style="margin-right:20px;" ToolTip="Imprimir este cadastro"/>
		            </a>
	            </div>
                <asp:Panel ID="panelAlimentos" runat="server" style="float:left;width:100%" >
                    <asc:GridViewCustom
                        ID="gridViewAlimentos"
                        runat="server"
					    Width="60%"
                        AutoGenerateColumns="False"
                        AllowSorting="True"
                        CssClass="tablestyle"
                        OnDataBound="gridViewAlimentos_DataBound"
                        OnRowDataBound="gridViewAlimentos_OnRowDataBound"
                        OnRowCommand="gridViewAlimentos_OnRowCommand"
                        DataSourceID="dataSourceAlimentos"
                        AllowPaging="True"
				        BackColor="#E9E9E9"
				        GridLines="None"
                        OnSorted="gridViewAlimentos_OnSorted"
                        OnPageIndexChanged="gridViewAlimentos_OnPageIndexChanged"
                        CellPadding="4"
                        HorizontalAlign="center"
                        >
                        <AlternatingRowStyle BackColor="#f7f7f7"/>
				        <HeaderStyle BackColor="#EEEEEE" ForeColor="Black" />
					    <RowStyle Height="50px" BackColor="#FFFFFF"/>
                        <EmptyDataRowStyle BackColor="#F7F7F7" Height="50px" VerticalAlign="Middle" HorizontalAlign="Center" />
                        <EmptyDataTemplate >
                            Nenhum Resultado Encontrado
                        </EmptyDataTemplate>                                                                              
                    
                        <Columns>
                            <asp:TemplateField HeaderStyle-Width="5%" ShowHeader="false">
					            <ItemTemplate>
                                    <asp:HiddenField ID="hiddenFieldId" runat="server" Value="" />
				                </ItemTemplate>
				            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Produto">
				                <ItemTemplate> 
				                    <asp:Label ID="labelDescricaoEstoque" runat="server" Text='<%# Eval("produto.Nome_Produto") %>' ></asp:Label>
				                </ItemTemplate>
				                <headerstyle Width="20%"/>
				                <itemstyle HorizontalAlign="Center"/>
				            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Quantidade">
				                <ItemTemplate> 
				                    <asp:Label ID="labelQuantidadeEstoque" runat="server" Text='<%# Eval("quantidade_estoque") %>' ></asp:Label>
				                </ItemTemplate>
				                <headerstyle Width="20%" HorizontalAlign="Right"/>
				                <itemstyle Width="20%" HorizontalAlign="Right"/>
				            </asp:TemplateField>
                            <asp:TemplateField>
				                <ItemTemplate> 
				                    <asp:Label ID="labelUnidadeDeMedida" runat="server" Text='<%# Eval("produto.Unidade_De_Medida.Sigla_Unidade_De_Medida") %>' ></asp:Label>
				                </ItemTemplate>
				                <headerstyle Width="5%"/>
				            </asp:TemplateField>
                        </Columns>
                        <PagerTemplate>
                                <table width="100%" >
                                <tr>
                                    <td style="text-align:  left">
                                        Page Size: 
                                        <asp:DropDownList ID="ddPageSize" runat="server" EnableViewState="true" OnSelectedIndexChanged="ddPageSize_SelectedIndexChanged" AutoPostBack="true">
                                            <asp:ListItem Text="10" ></asp:ListItem>
                                            <asp:ListItem Text="15" ></asp:ListItem>
                                            <asp:ListItem Text="20" ></asp:ListItem>
                                            <asp:ListItem Text="25" ></asp:ListItem>
                                            <asp:ListItem Text="30" ></asp:ListItem>
                                            <asp:ListItem Text="35" ></asp:ListItem>
                                            <asp:ListItem Text="40" ></asp:ListItem>
                                            <asp:ListItem Text="45" ></asp:ListItem>
                                            <asp:ListItem Text="50" ></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                    <td style="text-align: right">
                                        <asp:Label ID="lblPageCount" runat="server"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </PagerTemplate>
                        </asc:GridViewCustom>                               
	                    <div style="margin-top:5px">
	                        <asp:DataPager  ID="pagerAlimentos" PageSize="10" runat="server" PagedControlID="gridViewAlimentos">
	                            <Fields>                                            
	                                <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" LastPageText="&gt;&gt;" 
	                                    NextPageText="&gt;"  PreviousPageText="&lt;" ShowFirstPageButton="True"
	                                    ShowNextPageButton="False" ButtonCssClass="datapager" />
	                                <asp:NumericPagerField ButtonCount="10"  NumericButtonCssClass="datapager" CurrentPageLabelCssClass="datapager"   />
	                                <asp:NextPreviousPagerField LastPageText="&gt;&gt;" NextPageText="&gt;" 
	                                    ShowLastPageButton="True" ShowPreviousPageButton="False" ButtonCssClass="datapager" />
	                            </Fields>
	                        </asp:DataPager>
	                    </div>
                    </asp:Panel>
            
                    
                    <br />
                    <asp:ObjectDataSource ID="dataSourceAlimentos" runat="server" 
                        SelectMethod="BuscaEstoque" TypeName="LarDosIdosos.DataSources.DataSourceEstoque" 
                        EnablePaging="True" SelectCountMethod="TotalDeEstoque" 
                        SortParameterName="sortExpression">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="1" Name="Codigo_Tipo_Produto" Direction="Input" />
                        </SelectParameters>                                            
                    </asp:ObjectDataSource>

                </ContentTemplate>
          	</asp:UpdatePanel>
    </div>
</div>
</asp:Content>
